-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
fix: remove offline_access from default OAuth2 scope #30254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: remove offline_access from default OAuth2 scope #30254
Conversation
Hi! This is my first contribution to JHipster. I've implemented the fix requested in #30206 by removing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ionic blueprint uses offline_access.
It’s not a fix without further investigation.
Thank you for the review and the helpful context, @mshima — I wasn’t aware that the Ionic blueprint depends on offline_access, so that’s great insight. I’ll investigate how and where the Ionic blueprint uses this scope, and ensure my fix doesn’t break that functionality. My plan is to:
I’ll update the PR accordingly. Meanwhile, if you have any suggestions on where best to look for the Ionic blueprint’s use of offline_access, I’d appreciate the guidance! |
I think that, for now, the change should be only in the application.yml of the gateway, in case it is used for web applications. However, the management of the scope requires analysis in the case of microservices currently registered with the internal client issuer.
In the case of offline flows (that need to access resources on behalf of the user even when the user is not online), the offline_access scope should be requested, but only if an SSO session was previously created without this scope (for web applications). Anyway, the management should be such that the token is reused for refresh as long as it is valid; otherwise, there's a risk of creating too much offline sessions in Keycloak that will never actually be used and that Keycloak will only clean up after a certain amount of time. I believe the last two points should be implemented by whoever uses JHipster, based on their specific needs — unless JHipster provides predefined utilities to simplify development. |
8bbcf1e
to
029d413
Compare
Following your feedback, I investigated both proposed paths. It turns out there's only one universal application.yml template used across all application types, so a targeted “gateway-only” edit isn’t feasible. To address @mshima’s valid concern about the Ionic blueprint, while still fixing the SSO bug in web apps (per @ldaloia-dev's suggestion), I’ve updated the PR to include the offline_access scope only when clientFramework === 'ionic'. |
029d413
to
bf2ac37
Compare
Description
Removes
offline_access
from the default OAuth2 client scope configuration in JHipster applications.Problem
Currently, JHipster applications request
offline_access
scope by default, which causes:Solution
offline_access
from default scope inapplication.yml.ejs
offline_access
for regular web appsoffline_access
should only be requested for long-running processes, not standard web applicationsTesting
offline_access
as optional scope for applications that explicitly need itFixes #30206